//
//  MyheaderBar.m
//  CarTown
//
//  Created by xionghao on 15/8/27.
//  Copyright (c) 2015年 熊浩. All rights reserved.
//

#import "MyheaderBar.h"

@interface MyheaderBar ()
@property (weak, nonatomic) IBOutlet UIView *shouchangview;
@property (weak, nonatomic) IBOutlet UIView *guanzhuview;

@end


@implementation MyheaderBar

+(instancetype)headerbar{
    MyheaderBar *header=[[[NSBundle mainBundle]loadNibNamed:@"MyheaderBar" owner:nil options:nil]firstObject];
    return header;
}
-(void)awakeFromNib{
    UITapGestureRecognizer *tap1=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(guanzhuclick:)];
    self.guanzhuview.userInteractionEnabled=YES;
    [self.guanzhuview addGestureRecognizer:tap1];
    UITapGestureRecognizer *tap2=[[UITapGestureRecognizer alloc]initWithTarget:self action:@selector(cheyaunclick:)];
    self.shouchangview.userInteractionEnabled=YES;
    [self.shouchangview addGestureRecognizer:tap2];
}

- (void)cheyaunclick:(UITapGestureRecognizer *)sender {
    [self clickWithTag:0];
}
- (void)guanzhuclick:(UITapGestureRecognizer *)sender {
    [self clickWithTag:1];
}
- (IBAction)shengjiclick:(UIButton *)sender {
    [self clickWithTag:2];
}

-(void)clickWithTag:(NSInteger)tag{
    if ([_delegate respondsToSelector:@selector(HeadViewBarclickWithIndex:)]) {
        [_delegate HeadViewBarclickWithIndex:tag];
    }
}


/*
// Only override drawRect: if you perform custom drawing.
// An empty implementation adversely affects performance during animation.
- (void)drawRect:(CGRect)rect {
    // Drawing code
}
*/

@end
